package com.study.leetcode;

public class Solution_389 {
    public char findTheDifference(String s, String t) {
        int[] charts = new int[26];
        char c = 'a';
        for (int i = 0; i < s.length(); i++) {
            charts[s.charAt(i) - 'a']++;
        }
        for (int i = 0; i < t.length(); i++) {
            charts[t.charAt(i) - 'a']--;
        }
        for (int i = 0; i < charts.length; i++) {
            if (charts[i] == -1) {
                c = (char) ('a' + i);
                break;
            }
        }
        return c;
    }

    public static void main(String[] args) {
        Solution_389 solution389 = new Solution_389();
        char theDifference = solution389.findTheDifference("abcd", "abcde");
        System.out.println("theDifference = " + theDifference);
    }
}
